package com.tjsinfo.tjsoa.bylaws.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.bylaws.bo.IBylawsBO;
import com.tjsinfo.tjsoa.system.vo.User;
import com.tjsinfo.tjsoa.workplan.bo.IWorkPlanMainBo;

public class BylawsPViewAction extends Action {
	
	private IBylawsBO bylawsManager;

	public void setBylawsManager(IBylawsBO bylawsManager) {
		this.bylawsManager = bylawsManager;
	}
	private IWorkPlanMainBo workPlanMainBo;
	public IWorkPlanMainBo getWorkPlanMainBo() {
		return workPlanMainBo;
	}

	public void setWorkPlanMainBo(IWorkPlanMainBo workPlanMainBo) {
		this.workPlanMainBo = workPlanMainBo;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		try {

			HttpSession session=request.getSession();
			User user = (User)session.getAttribute("user");
						
			String id=request.getParameter("id");
			List bylaws=null;
			bylaws=bylawsManager.findByProperty("id", id);
			
			request.setAttribute("bylaws", bylaws);
			
			
			workPlanMainBo.selectMapWorkPlanMain(request);
			return mapping.findForward("success");
		} catch (Exception e) {
			return mapping.findForward("failed");
		}
	}
}
